<?php

namespace STAGE\StageBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use STAGE\UserBundle\Form\EncadreurType;

class SocieteType extends AbstractType {

    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options) {
        $builder
                ->add('nom')
                ->add('telFixe', 'text')
                ->add('telFax', 'text')
                ->add('department')
                ->add('adresse', 'textarea')
                ->add('encadreurs', 'collection', array(
                    'type' => new EncadreurType(),
                    'allow_add' => true,
                    'allow_delete' => true,
                    'by_reference' => false,
                ))
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver) {
        $resolver->setDefaults(array(
            'data_class' => 'STAGE\StageBundle\Entity\Societe'
        ));
    }

    /**
     * @return string
     */
    public function getName() {
        return 'stage_stagebundle_societe';
    }

}
